/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/


// testpglDoc.cpp : implementation of the CTestpglDoc class
//

#include "stdafx.h"
#include "testpgl.h"

#include "testpglDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestpglDoc

IMPLEMENT_DYNCREATE(CTestpglDoc, CDocument)

BEGIN_MESSAGE_MAP(CTestpglDoc, CDocument)
	//{{AFX_MSG_MAP(CTestpglDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestpglDoc construction/destruction

CTestpglDoc::CTestpglDoc()
{
	// TODO: add one-time construction code here

}

CTestpglDoc::~CTestpglDoc()
{
}

BOOL CTestpglDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	m_pRegion.reset();
	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CTestpglDoc serialization

void CTestpglDoc::Serialize(CArchive& ar)
{
	if (ar.IsLoading() && !m_pRegion)
		m_pRegion = CPGLRegionPtr(new CPGLRegion());

	CPGLArchive pglArchive(m_pRegion, ar, NULL);
}

/////////////////////////////////////////////////////////////////////////////
// CTestpglDoc diagnostics

#ifdef _DEBUG
void CTestpglDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CTestpglDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTestpglDoc commands

void CTestpglDoc::SetRegion(CPGLRegionPtr pRegion)
{
	m_pRegion = pRegion;
}
